<?php
/**
 * 缓存前缀
 */

defined('CACHE_PRE_CARTOON') or define('CACHE_PRE_CARTOON','cartoon_');
defined('CACHE_PRE_CHAPTER') or define('CACHE_PRE_CHAPTER','chapter_');

define('ERR_CT_SCORED',-100);

class CONST_CT{
	const RECOM_HOME	=	1;	//首页推荐
	const RECOM_HOT		=	2;	//热门推荐
	const RECOM_NEW		=	3;	//最新推荐
}

/**
 * 缓存相关设置
 */
$_SERVER['cache']	=	array(
	CONST_CT::RECOM_HOME => array('path' =>'recomm/home','filename'=>'recom_strong','expire' => 3600*6,'num'=>8,'order'=>'id'),
	CONST_CT::RECOM_HOT => array('path' =>'recomm/hot','filename'=>'recom_hot','expire' => 3600*6,'num'=>8,'order'=>'id'),
	CONST_CT::RECOM_NEW => array('path' =>'recomm/new','filename'=>'recom_new','expire' => 3600*6,'num'=>4,'order'=>'id'),
	
);

$_SERVER['cartoon'] = array(
	'nation' =>array('1'=>'日本','2'=>'欧美','港台','大陆'),
	'language' => array('jp'=>'日文','en'=>'英文','cn'=>'中文'),
	'tag_type' => array('1'=>'作者','2'=>'类别','3'=>'系列'),
	'reader_group' => array('1'=>'儿童漫画','2'=>'少年漫画','3'=>'少女漫画')
);

/**
 * 上传图片尺寸
 * @var unknown_type
 */
$_SERVER['upload_size'] = array(
	'mid'	=>	array('width'=>131,'heigth'=>178),	//中图大小
	'small'	=>	array('width'=>60,'heigth'=>60)		//小图尺寸
);

/**
 * 生成图片信息
 * @param unknown_type $img_url
 * @param unknown_type $type
 */
function makeImgUrl($img_url,$type='mid'){
	if($img_url){
		$fileinfo = pathinfo($img_url);
		$ext = $fileinfo['extension'];
		$file_name = $fileinfo['basename'];
		$path = $fileinfo['dirname'];
		if(in_array(strtolower($type),array('mid','small','big'))){
			$file_name = str_replace('.'.$ext,'_'.$type.'.'.$ext,$file_name);
		}
		return 	UPLOAD_DOMAIN.'/'.$path.'/'.$file_name;
	}
}

?>